class Solution:
    def sumBase(self, n: int, k: int) -> int:
        ans = []
        while n >= 1:
            ans.append(n % k)
            n //= k
        return sum(ans)


if __name__ == "__main__":
    print(Solution().sumBase(34, 6))  # 9
    print(Solution().sumBase(10, 10))  # 1

    print(Solution().sumBase(1, 2))  # 1
